import request from '../request'

// 用户登录
export function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

// 用户注册
export function register(data) {
  return request({
    url: '/auth/register',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/user/info',
    method: 'get'
  })
}

// 更新用户信息
export function updateUserInfo(data) {
  return request({
    url: '/user/info',
    method: 'put',
    data
  })
}

// 修改密码
export function changePassword(data) {
  return request({
    url: '/user/password',
    method: 'put',
    data
  })
}

// 获取用户设置
export function getUserSettings() {
  return request({
    url: '/user/settings',
    method: 'get'
  })
}

// 更新用户设置
export function updateUserSettings(data) {
  return request({
    url: '/user/settings',
    method: 'put',
    data
  })
}

// 获取用户通知列表
export function getUserNotifications(params) {
  return request({
    url: '/user/notifications',
    method: 'get',
    params
  })
}

// 标记通知为已读
export function markNotificationAsRead(notificationId) {
  return request({
    url: `/user/notifications/${notificationId}/read`,
    method: 'put'
  })
}

// 标记所有通知为已读
export function markAllNotificationsAsRead() {
  return request({
    url: '/user/notifications/read-all',
    method: 'put'
  })
}

// 删除通知
export function deleteNotification(notificationId) {
  return request({
    url: `/user/notifications/${notificationId}`,
    method: 'delete'
  })
}

// 获取用户操作日志
export function getUserLogs(params) {
  return request({
    url: '/user/logs',
    method: 'get',
    params
  })
}

// 获取用户统计数据
export function getUserStats() {
  return request({
    url: '/user/stats',
    method: 'get'
  })
}

// 绑定第三方账号
export function bindThirdPartyAccount(data) {
  return request({
    url: '/user/third-party/bind',
    method: 'post',
    data
  })
}

// 解绑第三方账号
export function unbindThirdPartyAccount(platform) {
  return request({
    url: `/user/third-party/${platform}/unbind`,
    method: 'delete'
  })
} 